<?php

namespace App\Remote\MeiTuan;

use App\Exceptions\BaseException;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;


class MeiTuanShopRemote extends Remote
{
    /**
     * @inheritDoc
     */
    static function getBaseUri(): string
    {
        // TODO: Implement getBaseUri() method.
        return "https://e.waimai.meituan.com";
    }

    /**
     * 门店列表
     *
     * @param string $cookie
     * @param int $pageNum
     * @param int $pageSize
     * @param int $isOpen
     * @param string $keyWord
     * @param string $cities
     * @return mixed
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function shopList(
        string $cookie,
        int $pageNum = 1,
        int $pageSize = 20,
        int $isOpen = 0,
        string $keyWord = "",
        string $cities = ""
    ) {
        return self::customRequestV3(
            vsprintf("/v2/shop/businessStatus/r/poiListSearch?isOpen=%d&keyWord=%s&cities=%s&pageNum=%d&pageSize=%d&ignoreSetRouterProxy=true",
                [
                    $isOpen,
                    $keyWord,
                    $cities,
                    $pageNum,
                    $pageSize
                ]),
            RequestAlias::METHOD_GET,
            null,
            ["Cookie" => $cookie]
        );
    }
}
